$OpenBSD: patch-daily_sh,v 1.16 2017/05/30 21:05:44 sthen Exp $

Index: daily.sh
--- daily.sh.orig
+++ daily.sh
@@ -25,10 +25,10 @@ LIBRENMS_DIR=$(dirname "$DAILY_SCRIPT")
 
 # set log_file, using librenms $config['log_dir'], if set
 # otherwise we default to <LibreNMS Install Directory>/logs
-LOG_DIR=$(php -r "@include '${LIBRENMS_DIR}/config.php'; echo isset(\$config['log_dir']) ? \$config['log_dir'] : '${LIBRENMS_DIR}/logs';")
+LOG_DIR=$(%PHP% -r "@include '${LIBRENMS_DIR}/config.php'; echo isset(\$config['log_dir']) ? \$config['log_dir'] : '${LIBRENMS_DIR}/logs';")
 
 # get the librenms user
-LIBRENMS_USER=$(php -r "@include '${LIBRENMS_DIR}/config.php'; echo isset(\$config['user']) ? \$config['user'] : 'root';")
+LIBRENMS_USER=$(%PHP% -r "@include '${LIBRENMS_DIR}/config.php'; echo isset(\$config['user']) ? \$config['user'] : 'root';")
 LIBRENMS_USER_ID=$(id -u "$LIBRENMS_USER")
 
 
@@ -70,7 +70,7 @@ status_run() {
     else
         printf " \033[0;31mFAIL\033[0m\n";
         if [[ "${arg_option}" == "update" ]]; then
-            php "${LIBRENMS_DIR}/daily.php" -f notify -o "${tmp}"
+            %PHP% "${LIBRENMS_DIR}/daily.php" -f notify -o "${tmp}"
         fi
     fi
     return ${exit_code}
@@ -91,7 +91,7 @@ call_daily_php() {
     local args=( "$@" );
 
     for arg in "${args[@]}"; do
-        php "${LIBRENMS_DIR}/daily.php" -f "${arg}";
+        %PHP% "${LIBRENMS_DIR}/daily.php" -f "${arg}";
     done
 }
 
@@ -123,7 +123,7 @@ main () {
     fi
 
     if [[ -z "$arg" ]]; then
-        up=$(php daily.php -f update >&2; echo $?)
+        up=$(%PHP% daily.php -f update >&2; echo $?)
         if [[ "$up" == "0" ]]; then
             $DAILY_SCRIPT no-code-update
             exit
@@ -161,12 +161,12 @@ main () {
             no-code-update)
                 # Updates of the code are disabled, just check for schema updates
                 # and clean up the db.
-                status_run 'Updating SQL-Schema' 'php includes/sql-schema/update.php'
+                status_run 'Updating SQL-Schema' '%PHP% includes/sql-schema/update.php'
                 status_run 'Cleaning up DB' "$DAILY_SCRIPT cleanup"
             ;;
             post-pull)
                 # List all tasks to do after pull in the order of execution
-                status_run 'Updating SQL-Schema' 'php includes/sql-schema/update.php'
+                status_run 'Updating SQL-Schema' '%PHP% includes/sql-schema/update.php'
                 status_run 'Updating submodules' "$DAILY_SCRIPT submodules"
                 status_run 'Cleaning up DB' "$DAILY_SCRIPT cleanup"
                 status_run 'Fetching notifications' "$DAILY_SCRIPT notifications"
